package 剑指offer.Month7_07.day11;

public class 只出现一次的数字 {
    public int singleNumber(int[] nums) {
        int sum = 0;
        int[] arr = new int[32];
        for (int num:nums) {
            for (int j = 0; j < 32; j++) {
                arr[j] += num >> (32 - j) & 1;
            }
        }
        int res = 0;
        for(int i = 0;i < 32;i++){
            res += arr[i] % 3 + res * 2;
        }
        return res;
    }
}
